<link rel="stylesheet" type="text/css" href="../style/style.css" />
<style type="text/css">
 table{
 	font-family:Verdana, Arial, Helvetica, sans-serif;
	font-size:11px;
 }
</style>
<script language="javascript">
function exit(Str)
{
		var kode_so = document.forms[Str].kode_so.value;
		var jabatan = document.forms[Str].jabatan.value;

		if (!opener.closed)
		{
			opener.document.forms[0].kode_jab.value = jabatan;
			opener.document.forms[0].jabatan1.value = kode_so;
			
			close();
		}
}

</script>

<?
	include("../lib/config.php");
	
	$sqlxxx  = "SELECT ROW_NUMBER() OVER (ORDER BY Jabatan) AS No, * FROM MstJabatan WHERE fungsional='".$HTTP_GET_VARS['show']."'";
	if(!empty($HTTP_GET_VARS['keyword']))
	{
		$sqlxxx .= " AND Jabatan LIKE '%".$HTTP_GET_VARS['keyword']."%'";
	}
	$sqlxxx .= "ORDER BY jabatan ASC";
	
	$sql = mssql_query($sqlxxx,$conn);
	
	if($HTTP_GET_VARS['show'] == 1){
		$F = "FUNGSIONAL";
	}
	else{
		$F = "STRUKTURAL";
	}
	
	echo"<fieldset><legend><b>DAFTAR JABATAN $F</b></legend>";
	echo"
	<form name='XXXX' action='".$PHP_SELF."' method=get>
	 &nbsp;Cari Jabatan: <input type='text' name='keyword'> <input type='submit' value='Cari' class='button'>
	 <input type='hidden' name='show' value='".$HTTP_GET_VARS['show']."'>
	</form>
	";
	echo"<table width=100%>";
	echo"
		<tr class=headlist>
		 <td>No.</td>
		 <td colspan=2>Jabatan</td>
		</tr>
	";
	while($row = mssql_fetch_array($sql)){
		echo"
		<form name='form$row[No]'>
		<tr class=contentlist>
		 <td align=right>$row[No]</td>
		 <td>$row[jabatan]</td>
		 <td><input type='button' value='&radic; pilih' class='button' onclick=\"Javascript:exit('form$row[No]');\">
		 <input type='hidden' value='$row[kode]' name='kode_so'>
		 <input type='hidden' value='$row[jabatan]' name='jabatan'>
		 </td>
		</tr>
		</form>
		";
	}
	
	echo"</table>";
?>